<?php namespace Home\Model;
use Hdphp\Model\Model;
use Hdphp\Cart;
//订单列表
class Orderslists extends Model{
//	指定表名
	protected $table = 'orders_lists';
//	压入到数据库
	public function store($oid){
//		1、查购物车数据
		$data = cart::getAllData(); 
//		sp($data);
//		组合商品属性	
		$attr = array();
//		2、组合数组，添加到数据库
		$arrData = array();
		foreach($data['goods'] as $k => $v){
			$arrData['quantity'] = $v['num'];
			$arrData['subtotal'] = $v['total'];
			$arrData['order_oid'] = $oid;
			$arrData['goods_gid'] = $v['id'];
			$arrData['goods_name'] = $v['name'];
			$arrData['buy_num'] = $v['num'];
			$arrData['unit_price'] = $v['price'];
				foreach($v['options'] as $name){
					$attr[] = $name;
				}
			$arrData['goods_attr'] = implode('-', $attr);
			$this->add($arrData);
		}
		return true;
	}
}




 ?>